' Alternative Host Mode for QmodemPro for Windows 1.10
'$include 'hostutil.scr'
' Constants
const BS = chr(8)
const LF = chr(10)
const CR = chr(13)
const ESC = chr(27)
const PrelogFileNamePart = "host.pre"
const MenuFileNamePart = "host.mnu"
const ProtocolFileNamePart = "host.pro"
const LogoffFileNamePart = "host.off"
const HelpFileNamePart = "host.hlp"
const UserFileNamePart = "host.usr"
const MsgHeaderFileNamePart = "host.hdr"
const MsgDetailFileNamePart = "host.msg"
const MaxMsgLines = 99
' Type declarations
dialog SetupDialog 18, 18, 214, 200
caption "QmodemPro Host Setup"
groupbox "Mode", 101, 18, 9, 74, 64
modeopen as radiobutton "Open", 102, 26, 23, 62, 12
modeclosed as radiobutton "Closed", 103, 26, 38, 62, 12
modecallback as radiobutton "Callback", 104, 26, 53, 62, 12
groupbox "Security", 150, 100, 9, 100, 64
maxtime as edittext 105, 151, 22, 42, 12
dospass as edittext 106, 151, 39, 42, 12
shutdownpass as edittext 107, 151, 56, 42, 12
rtext "Max time", -1, 108, 25, 41, 8
rtext "DOS pwd", -1, 108, 41, 41, 8
rtext "Shutdown pwd", -1, 108, 59, 41, 8
groupbox "File transfers", 160, 18, 80, 182, 85
dlpath as edittext 108, 22, 104, 169, 12
ulpath as edittext 109, 22, 130, 169, 12
ltext "Download path", -1, 24, 95, 62, 8
ltext "Upload path", -1, 24, 120, 69, 8
sysopanypath as checkbox "Sysop can download from any path", 110, 25, 148, 165, 12
pushbutton "&Modem...", 200, 15, 175, 50, 14
defpushbutton "OK", IDOK, 80, 175, 50, 14
pushbutton "Cancel", IDCANCEL, 150, 175, 50, 14
end dialog
dialog ModemSetupDialog 6, 15, 194, 179
caption "QmodemPro Host Modem Setup"
groupbox "", -1, 8, 9, 177, 139
init as edittext 101, 48, 17, 127, 12
answer as edittext 102, 48, 33, 47, 12
busy as edittext 103, 48, 49, 47, 12
ok as edittext 104, 48, 65, 47, 12
ring as edittext 105, 129, 33, 45, 12
ringcount as edittext 106, 148, 49, 27, 12
faxanswer as checkbox "&Fax answer", 107, 40, 86, 50, 12
faxato as checkbox "&Send ATO", 108, 110, 86, 50, 12
rtext "&Init", -1, 16, 19, 28, 8
rtext "&Answer", -1, 12, 34, 33, 8
rtext "&Busy", -1, 12, 50, 33, 8
rtext "&OK msg", -1, 13, 66, 32, 8
rtext "&Ring", -1, 105, 35, 20, 8
rtext "Ring &Count", -1, 106, 51, 38, 8
ltext "Note: Some modems (like US Robotics) require an ATO when answering a DATA call in auto FAX/DATA mode. Check the Send ATO box if your modem requires this.", -1, 20, 100, 150, 40
defpushbutton "OK", IDOK, 77, 156, 50, 14
pushbutton "Cancel", IDCANCEL, 137, 156, 50, 14
end dialog
type TUser
Name as string*25
Password as string*20
Level as integer
Phone as string*30
end type
type TMessageHeader
Sender as string*25
Receiver as string*25
Subject as string*75
DateTime as string*20
Private as integer
Received as integer
Killed as integer
Lines as integer
Detailpos as long
end type
' connection variables
dim Local as integer
dim Port as integer
dim ModemResult as string
dim BaudRate as long
dim LogonTime as DateTimeRec
dim LogoffTime as DateTimeRec
dim ForceLogoff as integer
dim Setup as SetupDialog
dim ModemSetup as ModemSetupDialog
dim User as TUser
dim MsgLines(MaxMsgLines) as string
dim PrelogFileName as string
dim MenuFileName as string
dim ProtocolFileName as string
dim LogoffFileName as string
dim HelpFileName as string
dim UserFileName as string
dim MsgHeaderFileName as string
dim MsgDetailFileName as string
dim ReceivedFaxes as integer
'$include 'hostcfg.scr'
declare sub PackMessages
' Utility routines
sub GetCurrentTime(dt as DateTimeRec)
do
dt.D = Today
dt.T = CurrentTime
loop until dt.D = Today
end sub
function MinutesSince(dt as DateTimeRec)
dim now as DateTimeRec
call GetCurrentTime(now)
while now.D > dt.D
now.D = now.D - 1
now.T = now.T + SecondsInDay
wend
MinutesSince = (now.T - dt.T) / 60
end function
function MinutesUntil(dt as DateTimeRec)
dim now as DateTimeRec
call GetCurrentTime(now)
while dt.D > now.D
now.D = now.D + 1
now.T = now.T - SecondsInDay
wend
MinutesUntil = (dt.T - now.T) / 60
end function
function TimeLeft as integer
TimeLeft = MinutesUntil(LogoffTime)
end function
function CallerHungUp as integer
CallerHungUp = (not Local and not Carrier) or ForceLogoff